﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAL;

public partial class role_delete : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            try
            {
                int id = int.Parse(Request["id"]);
                CMSModel.CMSEntities cms = DBManager.GetCmsEmtity();
                cms.Role.DeleteObject(cms.Role.Where(x => x.RoleId == id).First());
                cms.SaveChanges();
                ClientScript.RegisterStartupScript(GetType(), "aa","alert('删除成功');document.location='default.aspx'", true);
            }
            catch (Exception ex)
            {
                LogYuMin.LogWriter.GetWriter(LogYuMin.LogFile.error).Write(GetType(), "deleteRole", LogYuMin.LogStates.ERROR, ex);
                ClientScript.RegisterStartupScript(GetType(), "aa", "alert('删除失败');document.location='default.aspx'", true);
            }
        }
    }
}